from django.contrib import admin
from movie.vote.models import Movie, Screening, Rating

class ScreeningInline(admin.StackedInline):
  model = Screening
  extra = 1
  filter_horizontal = ['attendees', 'voters', 'downvoters']

class MovieAdmin(admin.ModelAdmin):
  search_fields = ['name']
  filter_horizontal = ['voters', 'downvoters']
  ordering = ['name']
  inlines = [
    ScreeningInline,
  ]
admin.site.register(Movie, MovieAdmin)

class ScreeningAdmin(admin.ModelAdmin):
  filter_horizontal = ['attendees', 'voters', 'downvoters']
  ordering = ['-date']
admin.site.register(Screening, ScreeningAdmin)

class RatingAdmin(admin.ModelAdmin):
  pass
admin.site.register(Rating, RatingAdmin)
